package com.hspedu.customgeneric;

/**
 * @Author Stringzhua
 * @Date 2024/3/14 14:52
 * description:
 */
public class CustomMethodGenericExercise {
    public static void main(String[] args) {
        Apple<String, Integer, Double> apple = new Apple<>();
        apple.fly(10);//Integer
        apple.fly(new Dog01());//Dog01
    }
}

class Apple<T, R, M> {
    public <E> void fly(E e) {
        System.out.println(e.getClass().getSimpleName());//getSimpleName()只显示运行类型的类型
    }

//    public void eat(U u) {//U没有声明,所以会报错
//    }

    public void run(M m) {
    }
}

class Dog01 {
}
